package com.huatai.datacenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huatai.datacenter.entity.TopicInfoEntity;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Lion
 * @date 2023/3/24  9:26
 */
public interface TopicInfoMapper extends BaseMapper<TopicInfoEntity> {

	@Select("select * from tb_topic_info where clusterId=#{clusterId} order by create_time desc")
	@Results({ @Result(id = true, column = "id", property = "id"),
		@Result(column = "topicName", property = "topicName"),
		@Result(column = "createTime", property = "createTime"),
		@Result(column = "fileSize", property = "fileSize"),
		/*@Result(column = "clusterId", property = "cluster")*/ })
	List<TopicInfoEntity> getTopicsByCluster(String clusterId);

	/*@Select("select * from tb_topic_info order by createTime desc")
	@Results({ @Result(id = true, column = "id", property = "id"),
		@Result(column = "topicName", property = "topicName"),
		@Result(column = "createTime", property = "createTime"),
		@Result(column = "fileSize", property = "fileSize"),
		@Result(column = "cluster", property = "cluster") })*/
	@Select("select * from tb_topic_info order by createTime desc")
	@Results({ @Result(id = true, column = "id", property = "id"),
		@Result(column = "topicName", property = "topicName"),
		@Result(column = "createTime", property = "createTime"),
		@Result(column = "fileSize", property = "fileSize"),
		 })
	List<TopicInfoEntity> getTopics();
}
